import { reactive, ref } from 'vue';
import { defineStore } from 'pinia';

// 使用setup模式定义
export const useCounterStore = defineStore('main', () => {
  const state = reactive({
    tagList: [
      { path: "/dashboard", title: "首页" }
    ]
  })
  // 设置标签
  function setTagsItem(item: { path: string; title: string; }) {
    state.tagList.push(item)
  }
  // 删除标签
  const delTagItem = (index: number) => {
    if (index !== 0) {
      state.tagList.splice(index, 1)
    }
  }
  return { state, setTagsItem, delTagItem };
});
